<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>GL.Shader</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="icon" href="../assets/favicon.ico">
    <script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">

<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
                <h1><img src="../assets/css/logo.png" title="" width="117" height="52"></h1>
        </div>
        <div class="yui3-u-1-4 version">
            <em>API Docs for: </em>
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
                    <h2 class="off-left">APIs</h2>
                    <div id="api-tabview" class="tabview">
                        <ul class="tabs">
                            <li><a href="#api-classes">Classes</a></li>
                            <li><a href="#api-modules">Modules</a></li>
                        </ul>
                
                        <div id="api-tabview-filter">
                            <input type="search" id="api-filter" placeholder="Type to filter APIs">
                        </div>
                
                        <div id="api-tabview-panel">
                            <ul id="api-classes" class="apis classes">
                                <li><a href="../classes/BBox.html">BBox</a></li>
                                <li><a href="../classes/geo.html">geo</a></li>
                                <li><a href="../classes/GL.html">GL</a></li>
                                <li><a href="../classes/gl.html">gl</a></li>
                                <li><a href="../classes/GL.Buffer.html">GL.Buffer</a></li>
                                <li><a href="../classes/GL.FBO.html">GL.FBO</a></li>
                                <li><a href="../classes/GL.Indexer.html">GL.Indexer</a></li>
                                <li><a href="../classes/GL.Mesh.html">GL.Mesh</a></li>
                                <li><a href="../classes/GL.Octree.html">GL.Octree</a></li>
                                <li><a href="../classes/GL.Shader.html">GL.Shader</a></li>
                                <li><a href="../classes/GL.Texture.html">GL.Texture</a></li>
                                <li><a href="../classes/LEvent.html">LEvent</a></li>
                            </ul>
                
                
                            <ul id="api-modules" class="apis modules">
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="yui3-u-3-4">
                <div id="api-options">
                    Show:
                    <label for="api-show-inherited">
                        <input type="checkbox" id="api-show-inherited" checked>
                        Inherited
                    </label>
            
                    <label for="api-show-protected">
                        <input type="checkbox" id="api-show-protected">
                        Protected
                    </label>
            
                    <label for="api-show-private">
                        <input type="checkbox" id="api-show-private">
                        Private
                    </label>
                    <label for="api-show-deprecated">
                        <input type="checkbox" id="api-show-deprecated">
                        Deprecated
                    </label>
            
                </div>
            
            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
<h1>GL.Shader Class</h1>
<div class="box meta">


        <div class="foundat">
            Defined in: <a href="../files/.._src_shader.js.html#l6"><code>..&#x2F;src&#x2F;shader.js:6</code></a>
        </div>


</div>


<div class="box intro">
    <p>Shader class to upload programs to the GPU</p>

</div>

    <div class="constructor">
        <h2>Constructor</h2>
<div id="method_GL.Shader" class="method item">
    <h3 class="name"><code>GL.Shader</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>vertexSource</code>
                </li>
                <li class="arg">
                        <code>fragmentSource</code>
                </li>
                <li class="arg">
                        <code>macros</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l6"><code>..&#x2F;src&#x2F;shader.js:6</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">vertexSource</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>(it also allows to pass a compiled vertex shader)</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">fragmentSource</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>(it also allows to pass a compiled fragment shader)</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">macros</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p>(optional) precompiler macros to be applied when compiling</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
    </div>

<div id="classdocs" class="tabview">
    <ul class="api-class-tabs">
        <li class="api-class-tab index"><a href="#index">Index</a></li>

            <li class="api-class-tab methods"><a href="#methods">Methods</a></li>
    </ul>

    <div>
        <div id="index" class="api-class-tabpanel index">
            <h2 class="off-left">Item Index</h2>

                <div class="index-section methods">
                    <h3>Methods</h3>

                    <ul class="index-list methods">
                            <li class="index-item method">
                                <a href="#method_bind">bind</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_draw">draw</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_drawBuffers">drawBuffers</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_drawRange">drawRange</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_extractShaderInfo">extractShaderInfo</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_getLocation">getLocation</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_hasAttribute">hasAttribute</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_hasUniform">hasUniform</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_setUniform">setUniform</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.compileSource">Shader.compileSource</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.createFX">Shader.createFX</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.expandImports">Shader.expandImports</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.fromURL">Shader.fromURL</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.getBlendShader">Shader.getBlendShader</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.getBlurShader">Shader.getBlurShader</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.getColoredScreenShader">Shader.getColoredScreenShader</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.getFlatScreenShader">Shader.getFlatScreenShader</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.getFlatShader">Shader.getFlatShader</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.getFXAAShader">Shader.getFXAAShader</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.getPartialQuadShader">Shader.getPartialQuadShader</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.getQuadShader">Shader.getQuadShader</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.getScreenShader">Shader.getScreenShader</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_Shader.getUniformFunc">Shader.getUniformFunc</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_toViewport">toViewport</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_uniforms">uniforms</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_updateShader">updateShader</a>

                            </li>
                    </ul>
                </div>



        </div>

            <div id="methods" class="api-class-tabpanel">
                <h2 class="off-left">Methods</h2>

<div id="method_bind" class="method item">
    <h3 class="name"><code>bind</code></h3>

        <span class="paren">()</span>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l355"><code>..&#x2F;src&#x2F;shader.js:355</code></a>
        </p>



    </div>

    <div class="description">
        <p>enables the shader (calls useProgram)</p>

    </div>




</div>
<div id="method_draw" class="method item">
    <h3 class="name"><code>draw</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>mesh</code>
                </li>
                <li class="arg">
                        <code>mode</code>
                </li>
                <li class="arg">
                        <code>index_buffer_name</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l488"><code>..&#x2F;src&#x2F;shader.js:488</code></a>
        </p>



    </div>

    <div class="description">
        <p>Renders a mesh using this shader, remember to use the function uniforms before to enable the shader</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">mesh</code>
                        <span class="type">Mesh</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">mode</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>could be gl.LINES, gl.POINTS, gl.TRIANGLES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">index_buffer_name</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>the name of the index buffer, if not provided triangles will be assumed</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_drawBuffers" class="method item">
    <h3 class="name"><code>drawBuffers</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>vertexBuffers</code>
                </li>
                <li class="arg">
                        <code>indexBuffer</code>
                </li>
                <li class="arg">
                        <code>mode</code>
                </li>
                <li class="arg">
                        <code>range_start</code>
                </li>
                <li class="arg">
                        <code>range_length</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l520"><code>..&#x2F;src&#x2F;shader.js:520</code></a>
        </p>



    </div>

    <div class="description">
        <p>render several buffers with a given index buffer</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">vertexBuffers</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p>an object containing all the buffers</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">indexBuffer</code>
                        <span class="type">IndexBuffer</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">mode</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>could be gl.LINES, gl.POINTS, gl.TRIANGLES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">range_start</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>first primitive to render</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">range_length</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>number of primitives to render</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_drawRange" class="method item">
    <h3 class="name"><code>drawRange</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>mesh</code>
                </li>
                <li class="arg">
                        <code>mode</code>
                </li>
                <li class="arg">
                        <code>start</code>
                </li>
                <li class="arg">
                        <code>length</code>
                </li>
                <li class="arg">
                        <code>index_buffer_name</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l502"><code>..&#x2F;src&#x2F;shader.js:502</code></a>
        </p>



    </div>

    <div class="description">
        <p>Renders a range of a mesh using this shader</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">mesh</code>
                        <span class="type">Mesh</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">mode</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>could be gl.LINES, gl.POINTS, gl.TRIANGLES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">start</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>first primitive to render</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">length</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>number of primitives to render</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">index_buffer_name</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>the name of the index buffer, if not provided triangles will be assumed</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_extractShaderInfo" class="method item">
    <h3 class="name"><code>extractShaderInfo</code></h3>

        <span class="paren">()</span>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l160"><code>..&#x2F;src&#x2F;shader.js:160</code></a>
        </p>



    </div>

    <div class="description">
        <p>It extract all the info about the compiled shader program, all the info about uniforms and attributes.
This info is stored so it works faster during rendering.</p>

    </div>




</div>
<div id="method_getLocation" class="method item">
    <h3 class="name"><code>getLocation</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">WebGLUniformLocation</span>
        </span>







    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l366"><code>..&#x2F;src&#x2F;shader.js:366</code></a>
        </p>



    </div>

    <div class="description">
        <p>Returns the location of a uniform or attribute</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type">String</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">WebGLUniformLocation</span>:
                    <p>location</p>

            </div>
        </div>


</div>
<div id="method_hasAttribute" class="method item">
    <h3 class="name"><code>hasAttribute</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Boolean</span>
        </span>







    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l243"><code>..&#x2F;src&#x2F;shader.js:243</code></a>
        </p>



    </div>

    <div class="description">
        <p>Returns if this shader has an attribute with the given name</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>name of the attribute</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Boolean</span>:
            </div>
        </div>


</div>
<div id="method_hasUniform" class="method item">
    <h3 class="name"><code>hasUniform</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Boolean</span>
        </span>







    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l232"><code>..&#x2F;src&#x2F;shader.js:232</code></a>
        </p>



    </div>

    <div class="description">
        <p>Returns if this shader has a uniform with the given name</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>name of the uniform</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Boolean</span>:
            </div>
        </div>


</div>
<div id="method_setUniform" class="method item">
    <h3 class="name"><code>setUniform</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
                <li class="arg">
                        <code>value</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l421"><code>..&#x2F;src&#x2F;shader.js:421</code></a>
        </p>



    </div>

    <div class="description">
        <p>Uploads a uniform to the Shader. You dont need to specify types, they are infered from the shader info. Shader must be binded!</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type">String</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">value</code>
                        <span class="type"></span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_Shader.compileSource" class="method item">
    <h3 class="name"><code>Shader.compileSource</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>type</code>
                </li>
                <li class="arg">
                        <code>source</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">WebGLShader</span>
        </span>







    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l77"><code>..&#x2F;src&#x2F;shader.js:77</code></a>
        </p>



    </div>

    <div class="description">
        <p>Compiles one single shader source (could be gl.VERTEX_SHADER or gl.FRAGMENT_SHADER) and returns the webgl shader handler
Used internaly to compile the vertex and fragment shader.
It throws an exception if there is any error in the code</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">type</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>could be gl.VERTEX_SHADER or gl.FRAGMENT_SHADER</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">source</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>the source file to compile</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">WebGLShader</span>:
                    <p>the handler from webgl</p>

            </div>
        </div>


</div>
<div id="method_Shader.createFX" class="method item">
    <h3 class="name"><code>Shader.createFX</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>code</code>
                </li>
                <li class="arg">
                        <code class="optional">[uniforms=null]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l1065"><code>..&#x2F;src&#x2F;shader.js:1065</code></a>
        </p>



    </div>

    <div class="description">
        <p>Allows to create a simple shader meant to be used to process a texture, instead of having to define the generic Vertex &amp; Fragment Shader code</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">code</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>string containg code, like &quot;color = color * 2.0;&quot;</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[uniforms=null]</code>
                        <span class="type">String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>string containg extra uniforms, like &quot;uniform vec3 u_pos;&quot;</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_Shader.expandImports" class="method item">
    <h3 class="name"><code>Shader.expandImports</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>code</code>
                </li>
                <li class="arg">
                        <code>files</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">String</span>
        </span>







    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l790"><code>..&#x2F;src&#x2F;shader.js:790</code></a>
        </p>



    </div>

    <div class="description">
        <p>Given a source code with the directive #import it expands it inserting the code using Shader.files to fetch for import files.
Warning: Imports are evaluated only the first inclusion, the rest are ignored to avoid double inclusion of functions
Also, imports cannot have other imports inside.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">code</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>the source code</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">files</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p>[Optional] object with files to import from (otherwise Shader.files is used)</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">String</span>:
                    <p>the code with the lines #import removed and replaced by the code</p>

            </div>
        </div>


</div>
<div id="method_Shader.fromURL" class="method item">
    <h3 class="name"><code>Shader.fromURL</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>vs_path</code>
                </li>
                <li class="arg">
                        <code>fs_path</code>
                </li>
                <li class="arg">
                        <code>on_complete</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Shader</span>
        </span>







    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l300"><code>..&#x2F;src&#x2F;shader.js:300</code></a>
        </p>



    </div>

    <div class="description">
        <p>Create a shader from two urls. While the system is fetching the two urls, the shader contains a dummy shader that renders black.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">vs_path</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>the url to the vertex shader</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">fs_path</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>the url to the fragment shader</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">on_complete</code>
                        <span class="type">Function</span>


                    <div class="param-description">
                        <p>[Optional] a callback to call once the shader is ready.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Shader</span>:
            </div>
        </div>


</div>
<div id="method_Shader.getBlendShader" class="method item">
    <h3 class="name"><code>Shader.getBlendShader</code></h3>

        <span class="paren">()</span>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l1195"><code>..&#x2F;src&#x2F;shader.js:1195</code></a>
        </p>



    </div>

    <div class="description">
        <p>Returns a shader that blends two textures
shader must have: u_factor, u_texture, u_texture2</p>

    </div>




</div>
<div id="method_Shader.getBlurShader" class="method item">
    <h3 class="name"><code>Shader.getBlurShader</code></h3>

        <span class="paren">()</span>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l1209"><code>..&#x2F;src&#x2F;shader.js:1209</code></a>
        </p>



    </div>

    <div class="description">
        <p>Returns a shader used to apply gaussian blur to one texture in one axis (you should use it twice to get a gaussian blur)
shader params are: vec2 u_offset, float u_intensity</p>

    </div>




</div>
<div id="method_Shader.getColoredScreenShader" class="method item">
    <h3 class="name"><code>Shader.getColoredScreenShader</code></h3>

        <span class="paren">()</span>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l1152"><code>..&#x2F;src&#x2F;shader.js:1152</code></a>
        </p>



    </div>

    <div class="description">
        <p>Returns a shader ready to render a colored textured quad in fullscreen, use with Mesh.getScreenQuad() mesh
shader params vec4 u_color and sampler2D u_texture</p>

    </div>




</div>
<div id="method_Shader.getFlatScreenShader" class="method item">
    <h3 class="name"><code>Shader.getFlatScreenShader</code></h3>

        <span class="paren">()</span>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l1137"><code>..&#x2F;src&#x2F;shader.js:1137</code></a>
        </p>



    </div>

    <div class="description">
        <p>Returns a shader ready to render a flat color quad in fullscreen, use with Mesh.getScreenQuad() mesh
shader params: vec4 u_color</p>

    </div>




</div>
<div id="method_Shader.getFlatShader" class="method item">
    <h3 class="name"><code>Shader.getFlatShader</code></h3>

        <span class="paren">()</span>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l1437"><code>..&#x2F;src&#x2F;shader.js:1437</code></a>
        </p>



    </div>

    <div class="description">
        <p>Returns a flat shader (useful to render lines)</p>

    </div>




</div>
<div id="method_Shader.getFXAAShader" class="method item">
    <h3 class="name"><code>Shader.getFXAAShader</code></h3>

        <span class="paren">()</span>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l1401"><code>..&#x2F;src&#x2F;shader.js:1401</code></a>
        </p>



    </div>

    <div class="description">
        <p>Returns a shader to apply FXAA antialiasing
params are vec2 u_viewportSize, vec2 u_iViewportSize or you can call shader.setup()</p>

    </div>




</div>
<div id="method_Shader.getPartialQuadShader" class="method item">
    <h3 class="name"><code>Shader.getPartialQuadShader</code></h3>

        <span class="paren">()</span>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l1181"><code>..&#x2F;src&#x2F;shader.js:1181</code></a>
        </p>



    </div>

    <div class="description">
        <p>Returns a shader ready to render part of a texture into the viewport
shader must have: u_position, u_size, u_viewport, u_transform, u_texture_area (vec4)</p>

    </div>




</div>
<div id="method_Shader.getQuadShader" class="method item">
    <h3 class="name"><code>Shader.getQuadShader</code></h3>

        <span class="paren">()</span>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l1167"><code>..&#x2F;src&#x2F;shader.js:1167</code></a>
        </p>



    </div>

    <div class="description">
        <p>Returns a shader ready to render a quad with transform, use with Mesh.getScreenQuad() mesh
shader must have: u_position, u_size, u_viewport, u_transform (mat3)</p>

    </div>




</div>
<div id="method_Shader.getScreenShader" class="method item">
    <h3 class="name"><code>Shader.getScreenShader</code></h3>

        <span class="paren">()</span>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l1122"><code>..&#x2F;src&#x2F;shader.js:1122</code></a>
        </p>



    </div>

    <div class="description">
        <p>Returns a shader ready to render a textured quad in fullscreen, use with Mesh.getScreenQuad() mesh
shader params: sampler2D u_texture</p>

    </div>




</div>
<div id="method_Shader.getUniformFunc" class="method item">
    <h3 class="name"><code>Shader.getUniformFunc</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>data</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Function</span>
        </span>







    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l255"><code>..&#x2F;src&#x2F;shader.js:255</code></a>
        </p>



    </div>

    <div class="description">
        <p>Tells you which function to call when uploading a uniform according to the data type in the shader
Used internally from extractShaderInfo to optimize calls</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">data</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p>info about the uniform</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Function</span>:
            </div>
        </div>


</div>
<div id="method_toViewport" class="method item">
    <h3 class="name"><code>toViewport</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>uniforms</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l1107"><code>..&#x2F;src&#x2F;shader.js:1107</code></a>
        </p>



    </div>

    <div class="description">
        <p>Renders a fullscreen quad with this shader applied</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">uniforms</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_uniforms" class="method item">
    <h3 class="name"><code>uniforms</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>uniforms</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l380"><code>..&#x2F;src&#x2F;shader.js:380</code></a>
        </p>



    </div>

    <div class="description">
        <p>Uploads a set of uniforms to the Shader. You dont need to specify types, they are infered from the shader info.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">uniforms</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_updateShader" class="method item">
    <h3 class="name"><code>updateShader</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>vertexSource</code>
                </li>
                <li class="arg">
                        <code>fragmentSource</code>
                </li>
                <li class="arg">
                        <code>macros</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_shader.js.html#l115"><code>..&#x2F;src&#x2F;shader.js:115</code></a>
        </p>



    </div>

    <div class="description">
        <p>It updates the code inside one shader</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">vertexSource</code>
                        <span class="type">String</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">fragmentSource</code>
                        <span class="type">String</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">macros</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p>[optional]</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
            </div>



    </div>
</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
